package com.example.mybatis.controller;

import com.example.mybatis.domain.User;
import com.example.mybatis.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class HelloController {
    @Autowired
    UserService userService;

    @GetMapping("/hello")
    public List<User> hello(){
        return userService.selectAllUsers();
    }

    @GetMapping("/hello2")
    public String hello2(){
        return userService.selectNamefromUser();
    }


    @GetMapping("/*")
    public String error(){
        return "404";
    }
}